// Created by Roman Novitsky on 28.05.2009


#region Imported Namespaces


using WtfManager.Framework;
using WtfManager.UIManager.Commands;


#endregion


namespace WtfManager.HierarchicalData
{
  internal class ParentProvider: Service, IParentItemProvider
  {
    #region Properties/Indexers


    public override string Description
    {
      get
      {
        return "Open Command extensions which provides TreeItem parent.";
      }
    }

    public override string Name
    {
      get
      {
        return "Parent Provider";
      }
    }


    #endregion


    #region Methods


    public object GetParent(object item)
    {
      if (item is TreeItem)
      {
        return ((TreeItem)item).Parent;
      }

      return null;
    }


    protected override void OnStateChnaged()
    {
    }


    protected override void OnUnload()
    {
    }


    protected override FrameworkComponentState OnInitialize()
    {
      return FrameworkComponentState.Initialized;
    }


    protected override FrameworkComponentState OnLoad()
    {
      return FrameworkComponentState.Loaded;
    }


    #endregion
  }
}